﻿package view.tips
{
    import com.core.*;
    import com.sh.game.global.*;
    import com.sh.game.util.*;
    import uiresource.tips.*;

    public class SkillTipsGame extends SkillTipsUI
    {
        private var obj:Object;
        private var cfgskill:Object;
        private var cfgGuanzhi:Array;

        public function SkillTipsGame()
        {
            this.cfgskill = ConfigDictionary.data.skill;
            this.cfgGuanzhi = ConfigDictionary.data.guanwei;
            this.mouseChildren = false;
            this.mouseEnabled = false;
            return;
        }// end function

        public function set data(param1:Object) : void
        {
            var _loc_6:int = 0;
            var _loc_7:Object = null;
            if (param1.cfg == null)
            {
                return;
            }
            var _loc_2:Boolean = true;
            var _loc_3:* = ModelProxy.getValue("data", "user");
            var _loc_4:* = ModelProxy.getValue("data", "skillShuLian")[param1.cfg.skillid];
            this.obj = param1.cfg;
            var _loc_5:* = UIGlobel.getItemd(3);
            itemImg.url = Config.getUrl(_loc_5 + this.obj.icon + ".jpg");
            nameLabel.text = param1.cfg.name + "Lv." + param1.cfg.level;
            typeLabel.text = param1.cfg.skilltype != 0 ? ("<font color=\'#a020f0\'>【主动技能】</font>") : ("<font color=\'#ff9912\'>【被动技能】</font>");
            levelLabel.text = "技能等级:" + param1.cfg.level;
            mofaLabel.text = "魔法消耗:<font color=\'#31cf08\'>" + param1.cfg.costMp + "点</font>";
            timeLabel.text = "冷却时间:<font color=\'#31cf08\'>" + param1.cfg.sleeptime + "秒</font>";
            descLabel.text = param1.cfg.description;
            if (int(param1.cfg.isup) == 1)
            {
                nextCon.visible = true;
                nextCon.y = descLabel.y + descLabel.height + 8;
                _loc_6 = param1.cfg.level + 1;
                _loc_7 = this.cfgskill[int(param1.cfg.skillid) + 10];
                if (_loc_7)
                {
                    levelLabel2.text = this.getLevelLimit(_loc_7);
                    if (_loc_4 > 0)
                    {
                        if (_loc_4 >= _loc_7.upcount)
                        {
                            shulianLabel.text = "熟练度:<font color=\'#31cf08\'>" + String(_loc_4) + "/" + _loc_7.upcount + "</font>  <font color=\'#00cb52\'>（野外挂机成长）</font>";
                        }
                        else
                        {
                            shulianLabel.text = "熟练度:<font color=\'#c62442\'>" + String(_loc_4) + "/" + _loc_7.upcount + "</font>  <font color=\'#00cb52\'>（野外挂机成长）</font>";
                        }
                    }
                    else
                    {
                        shulianLabel.text = "熟练度:<font color=\'#c62442\'>0/" + _loc_7.upcount + "</font>  <font color=\'#00cb52\'>（野外挂机成长）</font>";
                    }
                }
                back.height = nextCon.y + nextCon.height + 10;
            }
            else
            {
                back.height = descLabel.y + descLabel.height;
            }
            return;
        }// end function

        private function getLevelLimit(param1:Object) : String
        {
            var _loc_2:String = "";
            var _loc_3:* = ModelProxy.getValue("data", "user");
            if (int(_loc_3.rein) != 0 && int(param1.uprein) != 0)
            {
                if (int(_loc_3.rein) > int(param1.uprein))
                {
                    _loc_2 = "等级:<font color=\'#31cf08\'>" + _loc_3.rein + "转" + _loc_3.level + "级/" + param1.uprein + "转" + param1.studylv + "级</font>";
                }
                else if (int(_loc_3.rein) == int(param1.uprein))
                {
                    if (int(_loc_3.level) >= int(param1.studylv))
                    {
                        _loc_2 = "等级:<font color=\'#31cf08\'>" + _loc_3.rein + "转" + _loc_3.level + "级/" + param1.uprein + "转" + param1.studylv + "级</font>";
                    }
                    else
                    {
                        _loc_2 = "等级:<font color=\'#c62442\'>" + _loc_3.rein + "转" + _loc_3.level + "级/" + param1.uprein + "转" + param1.studylv + "级</font>";
                    }
                }
                else
                {
                    _loc_2 = "等级:<font color=\'#c62442\'>" + _loc_3.rein + "转" + _loc_3.level + "级/" + param1.uprein + "转" + param1.studylv + "级</font>";
                }
            }
            else if (int(_loc_3.rein) == 0 && int(param1.uprein) != 0)
            {
                _loc_2 = "等级:<font color=\'#c62442\'>" + _loc_3.level + "级/" + param1.uprein + "转" + param1.studylv + "级</font>";
            }
            else if (int(_loc_3.rein) != 0 && int(param1.uprein) == 0)
            {
                _loc_2 = "等级:<font color=\'#31cf08\'>" + _loc_3.rein + "转" + _loc_3.level + "级/" + param1.studylv + "级</font>";
            }
            else if (int(_loc_3.rein) == 0 && int(param1.uprein) == 0)
            {
                if (int(_loc_3.level) >= int(param1.studylv))
                {
                    _loc_2 = "等级:<font color=\'#31cf08\'>" + _loc_3.level + "级/" + param1.studylv + "级</font>";
                }
                else
                {
                    _loc_2 = "等级:<font color=\'#c62442\'>" + _loc_3.level + "级/" + param1.studylv + "级</font>";
                }
            }
            return _loc_2;
        }// end function

    }
}
